package com.neusoft.yuejian_01.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.neusoft.yuejian_01.R;
import com.neusoft.yuejian_01.base.BaseAdapter;
import com.neusoft.yuejian_01.javabean.ProfessorCourseBean;
import com.neusoft.yuejian_01.model.ConstPhoto;
import com.neusoft.yuejian_01.viewHolder.ProfessorCourseViewHolder;

import java.util.List;

import it.sephiroth.android.library.picasso.Picasso;

/**
 * Created by Administrator on 2017/10/9.
 */

public class ProfessorCourseAdapter extends BaseAdapter {
    public ProfessorCourseAdapter(Context context, List data) {
        super(context, data);
    }

    @Override
    protected RecyclerView.ViewHolder onCreateVH(ViewGroup parent, LayoutInflater layoutInflater, int viewType) {
        View itemView = layoutInflater.inflate(R.layout.item_professorcourselist, parent, false);
        ProfessorCourseViewHolder viewHolder = new ProfessorCourseViewHolder(itemView);
        return viewHolder;
    }

    @Override
    protected void onBindVH(RecyclerView.ViewHolder holder, List data, int position) {
        ProfessorCourseBean professorcourselist = (ProfessorCourseBean) data.get(position);
        ProfessorCourseViewHolder viewHolder = (ProfessorCourseViewHolder) holder;
        String professorcourseInfo = professorcourselist.getPc_info();
        String professorcourseName = professorcourselist.getPc_name();
        viewHolder.professorcourseInfoView.setText("\u3000\u3000"+professorcourseInfo);
        viewHolder.professorcourseNameView.setText(professorcourseName);
        String professorcoursePic = ConstPhoto.BASE_URL+ConstPhoto.ProfessorCourseFile+professorcourselist.getPc_pic();
        Picasso.with(context)
                .load(professorcoursePic)
                .placeholder(R.drawable.pic2)
                .into(viewHolder.professorcourseImage);
    }
}

